﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Playables.PlayableGraph
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using UnityEngine.Bindings;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine.Playables
{
  /// <summary>
  ///   <para>Use the PlayableGraph to manage Playable creations and destructions.</para>
  /// </summary>
  [NativeHeader("Runtime/Director/Core/HPlayableOutput.h")]
  [NativeHeader("Runtime/Director/Core/HPlayableGraph.h")]
  [NativeHeader("Runtime/Director/Core/HPlayable.h")]
  [NativeHeader("Runtime/Export/Director/PlayableGraph.bindings.h")]
  [UsedByNativeCode]
  public struct PlayableGraph
  {
    internal IntPtr m_Handle;
    internal uint m_Version;

    /// <summary>
    ///   <para>Returns the Playable with no output connections at the given index.</para>
    /// </summary>
    /// <param name="index">The index of the root Playable.</param>
    public Playable GetRootPlayable(int index) => new Playable(this.GetRootPlayableInternal(index));

    public bool Connect<U, V>(
      U source,
      int sourceOutputPort,
      V destination,
      int destinationInputPort)
      where U : struct, IPlayable
      where V : struct, IPlayable
    {
      return this.ConnectInternal(source.GetHandle(), sourceOutputPort, destination.GetHandle(), destinationInputPort);
    }

    public void Disconnect<U>(U input, int inputPort) where U : struct, IPlayable
    {
      this.DisconnectInternal(input.GetHandle(), inputPort);
    }

    public void DestroyPlayable<U>(U playable) where U : struct, IPlayable
    {
      this.DestroyPlayableInternal(playable.GetHandle());
    }

    public void DestroySubgraph<U>(U playable) where U : struct, IPlayable
    {
      this.DestroySubgraphInternal(playable.GetHandle());
    }

    public void DestroyOutput<U>(U output) where U : struct, IPlayableOutput
    {
      this.DestroyOutputInternal(output.GetHandle());
    }

    public int GetOutputCountByType<T>() where T : struct, IPlayableOutput
    {
      return this.GetOutputCountByTypeInternal(typeof (T));
    }

    /// <summary>
    ///   <para>Get PlayableOutput at the given index in the graph.</para>
    /// </summary>
    /// <param name="index">The output index.</param>
    /// <returns>
    ///   <para>The PlayableOutput at this given index, otherwise null.</para>
    /// </returns>
    public PlayableOutput GetOutput(int index)
    {
      PlayableOutputHandle handle;
      return !this.GetOutputInternal(index, out handle) ? PlayableOutput.Null : new PlayableOutput(handle);
    }

    public PlayableOutput GetOutputByType<T>(int index) where T : struct, IPlayableOutput
    {
      PlayableOutputHandle handle;
      return !this.GetOutputByTypeInternal(typeof (T), index, out handle) ? PlayableOutput.Null : new PlayableOutput(handle);
    }

    /// <summary>
    ///   <para>Evaluates all the PlayableOutputs in the graph, and updates all the connected Playables in the graph.</para>
    /// </summary>
    /// <param name="deltaTime">The time in seconds by which to advance each Playable in the graph.</param>
    public void Evaluate() => this.Evaluate(0.0f);

    /// <summary>
    ///   <para>Creates a PlayableGraph.</para>
    /// </summary>
    /// <param name="name">The name of the graph.</param>
    /// <returns>
    ///   <para>The newly created PlayableGraph.</para>
    /// </returns>
    public static PlayableGraph Create() => PlayableGraph.Create((string) null);

    /// <summary>
    ///   <para>Creates a PlayableGraph.</para>
    /// </summary>
    /// <param name="name">The name of the graph.</param>
    /// <returns>
    ///   <para>The newly created PlayableGraph.</para>
    /// </returns>
    public static PlayableGraph Create(string name)
    {
      PlayableGraph ret;
      PlayableGraph.Create_Injected(name, out ret);
      return ret;
    }

    /// <summary>
    ///   <para>Destroys the graph.</para>
    /// </summary>
    [FreeFunction("PlayableGraphBindings::Destroy", HasExplicitThis = true, ThrowsException = true)]
    public void Destroy() => PlayableGraph.Destroy_Injected(ref this);

    /// <summary>
    ///   <para>Returns true if the PlayableGraph has been properly constructed using PlayableGraph.CreateGraph and is not deleted.</para>
    /// </summary>
    /// <returns>
    ///   <para>A boolean indicating if the graph is invalid or not.</para>
    /// </returns>
    public bool IsValid() => PlayableGraph.IsValid_Injected(ref this);

    /// <summary>
    ///   <para>Indicates that a graph is presently running.</para>
    /// </summary>
    /// <returns>
    ///   <para>A boolean indicating if the graph is playing or not.</para>
    /// </returns>
    [FreeFunction("PlayableGraphBindings::IsPlaying", HasExplicitThis = true, ThrowsException = true)]
    public bool IsPlaying() => PlayableGraph.IsPlaying_Injected(ref this);

    /// <summary>
    ///   <para>Indicates that a graph has completed its operations.</para>
    /// </summary>
    /// <returns>
    ///   <para>A boolean indicating if the graph is done playing or not.</para>
    /// </returns>
    [FreeFunction("PlayableGraphBindings::IsDone", HasExplicitThis = true, ThrowsException = true)]
    public bool IsDone() => PlayableGraph.IsDone_Injected(ref this);

    /// <summary>
    ///   <para>Plays the graph.</para>
    /// </summary>
    [FreeFunction("PlayableGraphBindings::Play", HasExplicitThis = true, ThrowsException = true)]
    public void Play() => PlayableGraph.Play_Injected(ref this);

    /// <summary>
    ///   <para>Stops the graph, if it is playing.</para>
    /// </summary>
    [FreeFunction("PlayableGraphBindings::Stop", HasExplicitThis = true, ThrowsException = true)]
    public void Stop() => PlayableGraph.Stop_Injected(ref this);

    /// <summary>
    ///   <para>Evaluates all the PlayableOutputs in the graph, and updates all the connected Playables in the graph.</para>
    /// </summary>
    /// <param name="deltaTime">The time in seconds by which to advance each Playable in the graph.</param>
    [FreeFunction("PlayableGraphBindings::Evaluate", HasExplicitThis = true, ThrowsException = true)]
    public void Evaluate([DefaultValue("0")] float deltaTime)
    {
      PlayableGraph.Evaluate_Injected(ref this, deltaTime);
    }

    /// <summary>
    ///   <para>Returns how time is incremented when playing back.</para>
    /// </summary>
    [FreeFunction("PlayableGraphBindings::GetTimeUpdateMode", HasExplicitThis = true, ThrowsException = true)]
    public DirectorUpdateMode GetTimeUpdateMode()
    {
      return PlayableGraph.GetTimeUpdateMode_Injected(ref this);
    }

    /// <summary>
    ///   <para>Changes how time is incremented when playing back.</para>
    /// </summary>
    /// <param name="value">The new DirectorUpdateMode.</param>
    [FreeFunction("PlayableGraphBindings::SetTimeUpdateMode", HasExplicitThis = true, ThrowsException = true)]
    public void SetTimeUpdateMode(DirectorUpdateMode value)
    {
      PlayableGraph.SetTimeUpdateMode_Injected(ref this, value);
    }

    /// <summary>
    ///   <para>Returns the table used by the graph to resolve ExposedReferences.</para>
    /// </summary>
    [FreeFunction("PlayableGraphBindings::GetResolver", HasExplicitThis = true, ThrowsException = true)]
    public IExposedPropertyTable GetResolver() => PlayableGraph.GetResolver_Injected(ref this);

    /// <summary>
    ///   <para>Changes the table used by the graph to resolve ExposedReferences.</para>
    /// </summary>
    /// <param name="value"></param>
    [FreeFunction("PlayableGraphBindings::SetResolver", HasExplicitThis = true, ThrowsException = true)]
    public void SetResolver(IExposedPropertyTable value)
    {
      PlayableGraph.SetResolver_Injected(ref this, value);
    }

    /// <summary>
    ///   <para>Returns the number of Playable owned by the Graph.</para>
    /// </summary>
    [FreeFunction("PlayableGraphBindings::GetPlayableCount", HasExplicitThis = true, ThrowsException = true)]
    public int GetPlayableCount() => PlayableGraph.GetPlayableCount_Injected(ref this);

    /// <summary>
    ///   <para>Returns the number of Playable owned by the Graph that have no connected outputs.</para>
    /// </summary>
    [FreeFunction("PlayableGraphBindings::GetRootPlayableCount", HasExplicitThis = true, ThrowsException = true)]
    public int GetRootPlayableCount() => PlayableGraph.GetRootPlayableCount_Injected(ref this);

    [FreeFunction("PlayableGraphBindings::SynchronizeEvaluation", HasExplicitThis = true, ThrowsException = true)]
    internal void SynchronizeEvaluation(PlayableGraph playable)
    {
      PlayableGraph.SynchronizeEvaluation_Injected(ref this, ref playable);
    }

    /// <summary>
    ///   <para>Returns the number of PlayableOutput in the graph.</para>
    /// </summary>
    /// <returns>
    ///   <para>The number of PlayableOutput in the graph.</para>
    /// </returns>
    [FreeFunction("PlayableGraphBindings::GetOutputCount", HasExplicitThis = true, ThrowsException = true)]
    public int GetOutputCount() => PlayableGraph.GetOutputCount_Injected(ref this);

    [FreeFunction("PlayableGraphBindings::CreatePlayableHandle", HasExplicitThis = true, ThrowsException = true)]
    internal PlayableHandle CreatePlayableHandle()
    {
      PlayableHandle ret;
      PlayableGraph.CreatePlayableHandle_Injected(ref this, out ret);
      return ret;
    }

    [FreeFunction("PlayableGraphBindings::CreateScriptOutputInternal", HasExplicitThis = true, ThrowsException = true)]
    internal bool CreateScriptOutputInternal(string name, out PlayableOutputHandle handle)
    {
      return PlayableGraph.CreateScriptOutputInternal_Injected(ref this, name, out handle);
    }

    [FreeFunction("PlayableGraphBindings::GetRootPlayableInternal", HasExplicitThis = true, ThrowsException = true)]
    internal PlayableHandle GetRootPlayableInternal(int index)
    {
      PlayableHandle ret;
      PlayableGraph.GetRootPlayableInternal_Injected(ref this, index, out ret);
      return ret;
    }

    [FreeFunction("PlayableGraphBindings::DestroyOutputInternal", HasExplicitThis = true, ThrowsException = true)]
    internal void DestroyOutputInternal(PlayableOutputHandle handle)
    {
      PlayableGraph.DestroyOutputInternal_Injected(ref this, ref handle);
    }

    [FreeFunction("PlayableGraphBindings::IsMatchFrameRateEnabled", HasExplicitThis = true, ThrowsException = true)]
    internal bool IsMatchFrameRateEnabled()
    {
      return PlayableGraph.IsMatchFrameRateEnabled_Injected(ref this);
    }

    [FreeFunction("PlayableGraphBindings::EnableMatchFrameRate", HasExplicitThis = true, ThrowsException = true)]
    internal void EnableMatchFrameRate(FrameRate frameRate)
    {
      PlayableGraph.EnableMatchFrameRate_Injected(ref this, ref frameRate);
    }

    [FreeFunction("PlayableGraphBindings::DisableMatchFrameRate", HasExplicitThis = true, ThrowsException = true)]
    internal void DisableMatchFrameRate() => PlayableGraph.DisableMatchFrameRate_Injected(ref this);

    [FreeFunction("PlayableGraphBindings::GetFrameRate", HasExplicitThis = true, ThrowsException = true)]
    internal FrameRate GetFrameRate()
    {
      FrameRate ret;
      PlayableGraph.GetFrameRate_Injected(ref this, out ret);
      return ret;
    }

    [FreeFunction("PlayableGraphBindings::GetOutputInternal", HasExplicitThis = true, ThrowsException = true)]
    private bool GetOutputInternal(int index, out PlayableOutputHandle handle)
    {
      return PlayableGraph.GetOutputInternal_Injected(ref this, index, out handle);
    }

    [FreeFunction("PlayableGraphBindings::GetOutputCountByTypeInternal", HasExplicitThis = true, ThrowsException = true)]
    private int GetOutputCountByTypeInternal(System.Type outputType)
    {
      return PlayableGraph.GetOutputCountByTypeInternal_Injected(ref this, outputType);
    }

    [FreeFunction("PlayableGraphBindings::GetOutputByTypeInternal", HasExplicitThis = true, ThrowsException = true)]
    private bool GetOutputByTypeInternal(
      System.Type outputType,
      int index,
      out PlayableOutputHandle handle)
    {
      return PlayableGraph.GetOutputByTypeInternal_Injected(ref this, outputType, index, out handle);
    }

    [FreeFunction("PlayableGraphBindings::ConnectInternal", HasExplicitThis = true, ThrowsException = true)]
    private bool ConnectInternal(
      PlayableHandle source,
      int sourceOutputPort,
      PlayableHandle destination,
      int destinationInputPort)
    {
      return PlayableGraph.ConnectInternal_Injected(ref this, ref source, sourceOutputPort, ref destination, destinationInputPort);
    }

    [FreeFunction("PlayableGraphBindings::DisconnectInternal", HasExplicitThis = true, ThrowsException = true)]
    private void DisconnectInternal(PlayableHandle playable, int inputPort)
    {
      PlayableGraph.DisconnectInternal_Injected(ref this, ref playable, inputPort);
    }

    [FreeFunction("PlayableGraphBindings::DestroyPlayableInternal", HasExplicitThis = true, ThrowsException = true)]
    private void DestroyPlayableInternal(PlayableHandle playable)
    {
      PlayableGraph.DestroyPlayableInternal_Injected(ref this, ref playable);
    }

    [FreeFunction("PlayableGraphBindings::DestroySubgraphInternal", HasExplicitThis = true, ThrowsException = true)]
    private void DestroySubgraphInternal(PlayableHandle playable)
    {
      PlayableGraph.DestroySubgraphInternal_Injected(ref this, ref playable);
    }

    /// <summary>
    ///   <para>Returns the name of the PlayableGraph.</para>
    /// </summary>
    [FreeFunction("PlayableGraphBindings::GetEditorName", HasExplicitThis = true, ThrowsException = true)]
    public string GetEditorName() => PlayableGraph.GetEditorName_Injected(ref this);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void Create_Injected(string name, out PlayableGraph ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void Destroy_Injected(ref PlayableGraph _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool IsValid_Injected(ref PlayableGraph _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool IsPlaying_Injected(ref PlayableGraph _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool IsDone_Injected(ref PlayableGraph _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void Play_Injected(ref PlayableGraph _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void Stop_Injected(ref PlayableGraph _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void Evaluate_Injected(ref PlayableGraph _unity_self, [DefaultValue("0")] float deltaTime);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern DirectorUpdateMode GetTimeUpdateMode_Injected(
      ref PlayableGraph _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetTimeUpdateMode_Injected(
      ref PlayableGraph _unity_self,
      DirectorUpdateMode value);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern IExposedPropertyTable GetResolver_Injected(ref PlayableGraph _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetResolver_Injected(
      ref PlayableGraph _unity_self,
      IExposedPropertyTable value);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern int GetPlayableCount_Injected(ref PlayableGraph _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern int GetRootPlayableCount_Injected(ref PlayableGraph _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SynchronizeEvaluation_Injected(
      ref PlayableGraph _unity_self,
      ref PlayableGraph playable);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern int GetOutputCount_Injected(ref PlayableGraph _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void CreatePlayableHandle_Injected(
      ref PlayableGraph _unity_self,
      out PlayableHandle ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool CreateScriptOutputInternal_Injected(
      ref PlayableGraph _unity_self,
      string name,
      out PlayableOutputHandle handle);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void GetRootPlayableInternal_Injected(
      ref PlayableGraph _unity_self,
      int index,
      out PlayableHandle ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void DestroyOutputInternal_Injected(
      ref PlayableGraph _unity_self,
      ref PlayableOutputHandle handle);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool IsMatchFrameRateEnabled_Injected(ref PlayableGraph _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void EnableMatchFrameRate_Injected(
      ref PlayableGraph _unity_self,
      ref FrameRate frameRate);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void DisableMatchFrameRate_Injected(ref PlayableGraph _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void GetFrameRate_Injected(
      ref PlayableGraph _unity_self,
      out FrameRate ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool GetOutputInternal_Injected(
      ref PlayableGraph _unity_self,
      int index,
      out PlayableOutputHandle handle);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern int GetOutputCountByTypeInternal_Injected(
      ref PlayableGraph _unity_self,
      System.Type outputType);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool GetOutputByTypeInternal_Injected(
      ref PlayableGraph _unity_self,
      System.Type outputType,
      int index,
      out PlayableOutputHandle handle);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool ConnectInternal_Injected(
      ref PlayableGraph _unity_self,
      ref PlayableHandle source,
      int sourceOutputPort,
      ref PlayableHandle destination,
      int destinationInputPort);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void DisconnectInternal_Injected(
      ref PlayableGraph _unity_self,
      ref PlayableHandle playable,
      int inputPort);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void DestroyPlayableInternal_Injected(
      ref PlayableGraph _unity_self,
      ref PlayableHandle playable);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void DestroySubgraphInternal_Injected(
      ref PlayableGraph _unity_self,
      ref PlayableHandle playable);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern string GetEditorName_Injected(ref PlayableGraph _unity_self);
  }
}
